import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

class TstStack extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      backgroundColor: Colors.blue,
      appBar: AppBar(
        title: Text('Stack'),
      ),
      body: SafeArea(
          child: Column(
        children: <Widget>[
          Stack(
            children: <Widget>[
              Image(
                  image: NetworkImage(
                      'http://n.sinaimg.cn/sports/2_img/upload/cf0d0fdd/107/w1024h683/20181128/pKtl-hphsupx4744393.jpg')),
              Container(
                child: Text(
                  '这是一张NBA图片',
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 19.0,
                  ),
                ),
                padding: EdgeInsets.all(30.0),
              ),
              Positioned(
                bottom: 10.0,
                right: 20.0,
                child: Text('The copyright string for the software',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 19.0,
                    )),
              ),
            ],
          ),
          new SizedBox(height: 20.0),
          new Stack(
            alignment: const FractionalOffset(1, 1), //方法一
            children: <Widget>[
              new Image(
                image: NetworkImage(
                    'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1561638844893&di=080e25453a1674eaf7a47012289b1ddc&imgtype=0&src=http%3A%2F%2Fimg.bimg.126.net%2Fphoto%2FJpgj4lDlLjM-15hgXrRvmA%3D%3D%2F4570872146821444422.jpg'),
                width: 300.0,
                height: 200.0,
                fit: BoxFit.cover,
              ),
              Opacity(
                opacity: 0.8,
                child: Image(
                  image: NetworkImage(
                      'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1561638844893&di=a9f5b9af46432d5fe34d937df5b66b19&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201706%2F29%2F20170629115449_5asH3.jpeg'),
                  width: 200.0,
                  height: 150.0,
                  fit: BoxFit.cover,
                ),
              ),
              GestureDetector(
                onTap: () {
                  print('.....');

                  Fluttertoast.showToast(msg: "分享一下咯");
                },
                child: new Icon(Icons.share, color: Colors.white),
              ),
            ],
          )
        ],
      )),
    );
  }
}
